#include <iostream>
#include <unistd.h>
#include <assert.h>
#include <cstring>

using namespace std;

int main()
{
    int pipefd[2] = {0};
    int n = pipe(pipefd);
    assert(n != -1);

    pid_t id = fork();
    if(id == 0)
    {
        close(pipefd[1]);
        while(true)
        {

        }
    }

    close(pipefd[0]);
    char send_buff[1024] = "1234567890";
    int count = 0;
    while(true)
    {
        int ret = write(pipefd[1],send_buff,sizeof(send_buff));
        cout << count++ << endl;
    }

    close(pipefd[1]);
    return 0;
}